<?php
global $Config;
require_once($Config->WebCMSRoot.'Base/Data.mysql.php');

Class FotoData extends db
{
	
	function FotoData()
	{
		parent::db();

		$this->tableName = 'fotos';
		
		$this->AddMap("ID", "id", "id", DATATYPE_INTEGER, true);
		$this->AddMap("File", "file", "file", DATATYPE_TEXT, true);
		$this->AddMap("Thumbnail", "thumbnail", "thumbnail", DATATYPE_TEXT, false);
		$this->AddMap("VoorstellingID", "voorstelling_id", "voorstelling_id", DATATYPE_TEXT, true);
		$this->AddMap("Flag", "flag", "flag", DATATYPE_TEXT, true);
		}
  
	function Retrieve(&$foto)
	{
		$sql  = "SELECT ";
		$sql .= $this->GetFieldList();
		$sql .= "FROM " . $this->GetTableName();
		$sql .= $this->GetWhereClause($foto);
		$sql .= "ORDER BY file ";

		$foto->Collection = array();

//print($sql);
	    $rows = $this->Select($sql);
	    foreach($rows as $key=>$row)
	    {
			$foto->Collection[] = $this->FillRow($row);
		}
	}
  
	function FillRow($row)
	{
		$foto = new FotoModel();
		
		parent::FillRow(&$foto, &$row);
		
		return $foto;
	}
	
	function GetFieldList()
	{
		parent::GetFieldList(&$select);
		
		return $select;
	}
}
?>
